#include "SMPPCancelBroadcastSM.hpp"

using namespace smpp::pdu;

CancelBroadcastSM::CancelBroadcastSM(const Header &nHeader,
	const CoctetString &nServiceType,
	const CoctetString &nMessageId,
	const quint8 nSourceAddrTON,
	const quint8 nSourceAddrNPI,
	const CoctetString &nSourceAddr,
	const CancelBroadcastOptionalTLVs &nCancelBroadcastOptionalTLVs):
	Header(nHeader),
	_ServiceType(nServiceType),
	_MessageId(nMessageId),
	_SourceAddrTON(nSourceAddrTON),
	_SourceAddrNPI(nSourceAddrNPI),
	_SourceAddr(nSourceAddr),
	CancelBroadcastOptionalTLVs(nCancelBroadcastOptionalTLVs){}

CancelBroadcastSM::CancelBroadcastSM(
	const CancelBroadcastSM &nCancelBroadcastSM):
	Header(nCancelBroadcastSM),
	_ServiceType(nCancelBroadcastSM.getServiceType()),
	_MessageId(nCancelBroadcastSM.getMessageId()),
	_SourceAddrTON(nCancelBroadcastSM.getSourceAddrTON()),
	_SourceAddrNPI(nCancelBroadcastSM.getSourceAddrNPI()),
	_SourceAddr(nCancelBroadcastSM.getSourceAddr()),
	CancelBroadcastOptionalTLVs(nCancelBroadcastSM){}

void CancelBroadcastSM::setServiceType(const CoctetString &sServiceType){
	_ServiceType = sServiceType;
}

const CoctetString &CancelBroadcastSM::getServiceType() const{
	return _ServiceType;
}

void CancelBroadcastSM::setMessageId(const CoctetString &sMessageId){
	_MessageId = sMessageId;
}

const CoctetString &CancelBroadcastSM::getMessageId() const{
	return _MessageId;
}

void CancelBroadcastSM::setSourceAddrTON(const quint8 nSourceAddrTON){
	_SourceAddrTON = nSourceAddrTON;
}

const quint8 CancelBroadcastSM::getSourceAddrTON() const{
	return _SourceAddrTON;
}

void CancelBroadcastSM::setSourceAddrNPI(const quint8 nSourceAddrNPI){
	_SourceAddrNPI = nSourceAddrNPI;
}

const quint8 CancelBroadcastSM::getSourceAddrNPI() const{
	return _SourceAddrNPI;
}

void CancelBroadcastSM::setSourceAddr(const CoctetString &sSourceAddr){
	_SourceAddr = sSourceAddr;
}

const CoctetString &CancelBroadcastSM::getSourceAddr() const{
	return _SourceAddr;
}

void CancelBroadcastSM::calcCommandLength(){
	_CommandLength = 18 + _ServiceType.size() + 
		_MessageId.size() + _SourceAddr.size() +
		CancelBroadcastOptionalTLVs::getLength();
}
